package org.wk.news.api.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.wk.core.common.view.ResponseVo;
import org.wk.news.service.NewsClassifiedsService;
import org.wk.news.view.NewsClassifiedsVo;

import java.util.List;

/**
 * @ClassName NewsClassifiesController
 * @Description 资讯分类
 * @Author ZhaoPing'an
 * @Date 2018/6/14 9:26
 */
@RestController
public class NewsClassifiesController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private NewsClassifiedsService classifiedService;

    /**
     * @Description 获取新闻资讯分类
     * @Param []
     * @author ZhaoPing'an
     * @Date 2018/6/8 15:50
     */
    @RequestMapping(value="/newsclassifies",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseVo findAll(){
        logger.info("获取新闻资讯分类>>>>{}");
        List<NewsClassifiedsVo> list = classifiedService.findAll();
        logger.info("获取新闻资讯分类结果>>>>{}");
        return ResponseVo.success().setData(list);
    }
}
